When disasters occur and you need to get the data
back to a known state, you need to perform a restore operation. At
other times, you might want to restore data, such as when preparing for
log shipping or copying data from one server to another. You can also
use the RESTORE command to validate backups or read the catalog information from an existing media set.
Figure1 shows the options available with the restore process in Server Management Studio.
On
the General page, you essentially select what you intend to restore. If
you leave the default settings, the interface automatically selects the
options that provide you with the most recent data possible. The
backups selected at the bottom of the interface indicate what is going
to be restored. You can alternatively select a specific point in time
(equivalent to using the RESTORE statement with the STOP_AT option); in this case, the appropriate selections are made at the bottom of the interface, as shown in Figure 2.
If you make a selection yourself from the bottom of the dialog, as shown in Figure 6.4, you end up restoring the database to the end of what is in the last backup selected.
If
you have created an extra backup or you want to restore data backed up
from another server, you can use the From Device option and browse to
the location where the backup is stored.
If
you want to create a copy of the database for test purposes, you can
restore the data into a different database than the one originally
backed up by selecting the appropriate receiving database from the To
Database drop-down list.
The
Options page of the Restore dialog allows you to fine-tune a restore
operation as desired. Most of the options in Server Management Studio
are fairly straightforward and self-explanatory.
You
can choose to overwrite data in any existing database. You might need
to select this option when restoring data that was originally in
another database or on another server. You have to change the file
locations if the original paths are different from the destination file
paths.
You
can preserve the replication settings when restoring is available only
by selecting the option Leave the Database Ready for Use by Rolling
Back the Uncommitted Transactions, which is equivalent to restoring a
backup with the RECOVERY option. If
you select this option, SQL Server prevents replication settings from
being removed when a database backup or log backup is restored on a
warm standby server and the database is recovered.
When
you select Prompt Before Restoring Each Backup, you must confirm each
backup set before you restore it. This option is useful when you must
swap tapes for different media sets when the server has only one tape
device.
Restrict
Access to the Restored Database makes the restored database available
only to the members of db_owner, dbcreator, or sysadmin. This helps prevent users from accessing the data and gives administrators the ability to perform further operations.
On the bottom of the restore dialog, you can select the recovery options desired. The default, RESTORE WITH RECOVERY,
places the database in a standard usable state. If you want to apply
further backups, as in the case of a warm secondary database, you can
choose to leave the database non-operational by selecting RESTORE WITH NORECOVERY. When creating a read-only secondary server, you can select RESTORE WITH STANDBY and provide the path to the undo file.
As
you can see from the restore dialog, Server Management Studio provides
similar options to those available when you use the T-SQL RESTORE statement.